#include <iostream>
using namespace std;
int main(){
	
	int *p1, *p2, *p3;
	//p1 =(int *) malloc(sizeof(int));
	p1 = new int ; //在heap(堆)中分配一个int类型内存空间
	p2 = new int(123); //在heap(堆)中分配一个int类型内存空间并初始化为123
	p3 = new int[123]; //在heap(堆)中分配123个int类型内存空间
	*p1 = 100;
	p3[3] = 0x55;
	
	//free(p1);
	delete p1;
	delete p2;
	/*注释数组内存空间的释放
	 *如果写成 delete p3; 只释放了一个int 类型内存空间p3[0] 其余都未释放 造成内存泄漏
	 * */
	delete [] p3;
	
	return 0;
}
